<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>修改客服</title>
<style type="text/css">
/*元素初始值*/
html {background: #FFF;}
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,p,blockquote,th,td,ins,hr{margin: 0px;padding: 0px;}
p{cursor: text;}
h1,h2,h3,h4,h5,h6{font-size:100%;}
ol,ul{list-style-type: none;}
address,caption,cite,code,dfn,em,th,var{font-style:normal;font-weight:normal;}
table{border-collapse:collapse;}
fieldset,img{border:0;}
img{display:block;}
caption,th{text-align:left;}
body{position: relative;font-size:62.5%;font-family: "宋体"}
a{text-decoration: none;}
/*demo所用元素值*/
#need {margin: 20px auto 0;width: 610px;}
#need li {height: 26px;width: 600px;font: 12px/26px Arial, Helvetica, sans-serif;background: #FFD;border-bottom: 1px dashed #E0E0E0;display: block;cursor: text;padding: 7px 0px 7px 10px!important;padding: 5px 0px 5px 10px;}
#need li:hover,#need li.hover {background: #FFE8E8;}
.name input {line-height: 14px;background: #FFF;height: 14px;width: 200px;border: 1px solid #E0E0E0;vertical-align: middle;padding: 6px;}
#group input {line-height: 14px;background: #FFF;height: 14px;width: 50px;border: 1px solid #E0E0E0;vertical-align: middle;padding: 6px;}
#need label {padding-left: 30px;}
#need label.old_password_zzjs {background-position: 0 -277px;}
#need label.new_password_zzjs {background-position: 0 -1576px;}
#need label.rePassword_zzjs {background-position: 0 -1638px;}
#need label.email_zzjs {background-position: 0 -429px;}
#need dfn {display: none;}
#need li:hover dfn, #need li.hover dfn {display:inline;margin-left: 7px;color: #676767;}
</style>
<script type="text/javascript">
function suckerfish_zzjs(type, tag, parentId) {
if (window.attachEvent) {
window.attachEvent("onload", function() {
var sfEls = (parentId==null)?document.getElementsByTagName(tag):document.getElementById(parentId).getElementsByTagName(tag);
type(sfEls);
});
}
}
hover = function(sfEls) {
for (var i=0; i<sfEls.length; i++) {
sfEls[i].onmouseover=function() {
this.className+=" hover";
}
sfEls[i].onmouseout=function() {
this.className=this.className.replace(new RegExp(" hover\\b"), "");
}

}
}
suckerfish_zzjs(hover, "li");
</SCRIPT>
</head>
<body>
<ol id="need">
<form action="https://shahe.361053.com/api/kfFaq/edit" method="post">
        
    <input type="hidden" name="cpm" value="7">
    <input type="hidden" id="id" name="id" value="">
    <li><label class="old_password_zzjs">问题分组：</label>
    <label id="group">

    </label>
  </li>

<!--    <li class="name"><label class="old_password_zzjs">问题编号：</label><input type="text" id="number" name="number"><dfn>请输入编号！</dfn></li>-->
    <li class="name"><label class="old_password_zzjs">问题：</label><input type="text" id="question" name="question"><dfn>请输入问题！</dfn></li>
    <li class="name"><label class="old_password_zzjs">答案：</label><input type="text" id="answer" name="answer"><dfn>请输入答案！</dfn></li>
    <li class="name"><label class="old_password_zzjs">排序：</label><input type="text" name="sort"><dfn>请输入排序（数字越小越靠前）！</dfn></li>
    <li><button type="submit"  class="enter-btn" >修改</button>&nbsp;&nbsp;&nbsp;<button type="button" onclick="window.history.go(-1);" class="" >返回</button></li>
</form>
</ol>
</body>
<script type="text/javascript" src="jquery.min.js"></script>
 <script type="text/javascript">
        function edit() {
            $.post(window.location.protocol+'//'+window.location.host+'/api/kfFaq/edit', {'cpm':$('#cpm').val(),'id':$('#id').val(),'group':$('#group').val(),'uname':$('#uname').val()}, function (response) {
                response=eval(response);
                if(response.status == true){
                    location.href=window.location.protocol+'//'+window.location.host+'/kf/index.html';
                }else{
                    alert(response.msg);
                }
            }, 'json');
        }
    </script>
<script type="text/javascript">
    $(function () {
        function UrlSearch() 
        {
           var name,value; 
           var str=location.href; //取得整个地址栏
           var num=str.indexOf("?") 
           str=str.substr(num+1); //取得所有参数   stringvar.substr(start [, length ]

           var arr=str.split("&"); //各个参数放到数组里
           for(var i=0;i < arr.length;i++){ 
            num=arr[i].indexOf("="); 
            if(num>0){ 
             name=arr[i].substring(0,num);
             value=arr[i].substr(num+1);
             this[name]=value;
             } 
            } 
        } 
        var Request=new UrlSearch(); //实例化

        var kf_user_id = Request.id;
        var group =Request.group;
        var user_data = {
            id:kf_user_id
        };

        $.post(window.location.protocol+'//'+window.location.host+'/api/kfFaq/info', user_data, function (response) {
            response=eval(response);
            if (response.status == true) {
                var kf_faq = response.data;

                $('#id').val(kf_faq['id']);
                // $('#number').val(kf_faq['wx_uname']);
                $('#question').val(kf_faq['question']);
                $('#answer').val(kf_faq['answer']);
                $('#sort').val(kf_faq['sort']);
            } else {
                console.log('获取失败!！');
            }
        }, 'json');

        var send_data = {
        };
        $.post(window.location.protocol+'//'+window.location.host+'/api/kfUser/group', send_data, function (response) {
            if (response.status == true) {
                $('#group').empty('');
                messages = response.data;
                var send_message_str = '';
                for (var i in messages) {
                    var select='';
                    if(group.indexOf(messages[i]['str']) !=-1){
                        select='checked';
                    }
                    send_message_str += '<input type="checkbox" name="group[]" '+select+'  value="'+messages[i]['str']+'">'+messages[i]['content'];
                }
                $('#group').append(send_message_str);
            } else {
                console.log('获取失败!！');
            }
        }, 'json');
    });
</script>
</html>